#!/usr/bin/env node

var shelljs = require('shelljs');
var path = require('path');



buildGui()
buildPreload()
merge()




function buildGui() {
    shelljs.exec("cd gui && npm run build");
}

function buildPreload() {
    shelljs.exec("cd preload && npm run build");
}


function merge() {
    shelljs.exec("rm -rf ./dist/");
    var cpy = path.join(__dirname, '../node_modules/cpy-cli/cli.js');
    const cmds = [
        "./gui/dist/* ./dist/",
        "./preload/dist/* ./dist/",
        "./plugin/* ./dist/"
    ]
    for (let cmd of cmds) {
        shelljs.exec(cpy + "  " + cmd);
    }
}


